<?php
/**
 * Created by PhpStorm.
 * User: cape
 * Date: 2017/11/14
 * Time: 9:50
 */


header('content-type:text/html;charset=utf-8');


$fun = function () {
    return 'this is a test';
};


echo $fun();
echo '<hr/>';

$func = function ($username){
    return 'say hi to '.$username;
};

echo $func('king');
echo '<hr/>';


$func = create_function('', 'echo "this is a tst -------";');
$func();

echo '<hr/>';

$array = [1,2,3,4,5];
$res = array_map(function($var){return $var * 3;}, $array);
var_dump($res);
echo '<hr/>';
call_user_func(function ($username){echo "hello{$username}";}, 'king');


























